Verändert den Status eines Controls.
GUICtrlSetState ( controlID, state )
| ControlID | Die Identifikationsnummer des Controls (Control-ID), wie von einer GUICtrlCreate... Funktion zurückgegeben, oder -1 für das zuletzt erzeugte Control. |
| state | Siehe Status-Tabelle unten. |
| Erfolg: | 1. |
| Fehler: | 0. |
| Status | Kommentare |
|---|---|
| $GUI_CHECKED (1) | Radiobutton, Checkbox, MenüItem oder ein ListViewItem wird markiert |
| $GUI_INDETERMINATE (2) | Eine Checkbox mit Dreifach-Status-Attribut wird grau dargestellt |
| $GUI_UNCHECKED (4) | Markierung von Radiobutton, Checkbox, MenüItem oder eines ListViewItems wird entfernt |
| $GUI_DROPACCEPTED (8) | Control wird "Drop"-Aktionen annehmen: von Dateien oder von "Drag"-Aktionen eines anderen Controls. Siehe Bemerkungen |
| $GUI_SHOW (16) | Das Control wird sichtbar. Auf ein TabItem-Control angewendet, wird der vorderste Tab angezeigt |
| $GUI_HIDE (32) | Das Control wird unsichtbar |
| $GUI_ENABLE (64) | Das Control kann benutzt werden |
| $GUI_DISABLE (128) | Das Control wird grau dargestellt (kann nicht benutzt werden) |
| $GUI_FOCUS (256) | Das Control erhält den Eingabe- bzw. Auswahlfokus |
| $GUI_DEFBUTTON (512) | Das Control wird zum vor-ausgewählten Button des Fensters. |
| $GUI_EXPAND (1024) | Das TreeViewItem klappt seinen Unterverzeichnisbaum auf. |
| $GUI_ONTOP (2048) | Control hat das "immer im Vordergrund" Attribut für das Fenster (zOrdering). |
| $GUI_NODROPACCEPTED (4096) | Control wird keine "Drop"-Aktionen annehmen |
| $GUI_NOFOCUS (8192) | ListView-Controls verlieren den Fokus |
| $GUI_AVISTART (0) | Avi-Control beginnt mit dem Abspielen des avi-Videos |
| $GUI_AVISTOP (1) | Avi-Control stoppt das avi-Video |
| $GUI_AVICLOSE (2) | Avi-Control stoppt das Abspielen und gibt die Videodatei frei |
GUICtrlCreate..., GUICtrlGetState
#include <GUIConstantsEx.au3>
#include <WindowsStylesConstants.au3>
Example()
Func Example()
; Erstellt eine GUI mit verschiedenen Controls.
Local $hGui = GUICreate("Beispiel", 420, 200, -1, -1, -1, $WS_EX_ACCEPTFILES)
; Erstellt ein Label und setzt den Status "Drop"-Aktionen annehmen.
Local $idLabel = GUICtrlCreateLabel("Ziehe eine Datei auf dieses Label.", 10, 10, 400, 40, $WS_BORDER)
GUICtrlSetState($idLabel, $GUI_DROPACCEPTED)
; Erstellt ein Input und setzt den Status "Drop"-Aktionen annehmen.
Local $idInput = GUICtrlCreateInput("", 10, 60, 400, 22)
GUICtrlSetState($idInput, $GUI_DROPACCEPTED)
Local $idButton_OK = GUICtrlCreateButton("OK", 310, 370, 85, 25)
; Zeigt die GUI
GUISetState(@SW_SHOW, $hGui)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $idButton_OK
ExitLoop
Case $GUI_EVENT_DROPPED
; Falls der Wert von @GUI_DropId $idLabel ist, so wird der Pfad und Dateiname in das Label geschrieben.
If @GUI_DropId = $idLabel Then GUICtrlSetData($idLabel, @GUI_DragFile)
EndSwitch
WEnd
; Löscht die vorherige GUI und alle Controls.
GUIDelete($hGui)
EndFunc ;==>Example